package core 
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import client.lobby.games.GamesPanel;
	import client.lobby.login.LoginPanel;
	import client.services.GameService;
	/**
	 * ...
	 * @author rnk
	 */
	public class Screen extends Sprite
	{
		public static const WIDTH:int = 800;
		public static const HEIGHT:int = 600;
		
		private var currentScreen:Screen;
		public var papa:*;
		public var params:Array;
		
		public function Screen() 
		{
			
		}
		
		public function Init():void
		{
			
		}
		
		public function Die():void
		{
			ShowScreen(null);
		}
		
		public function SetPapa(papa:*):void
		{
			this.papa = papa;
		}
		
		public function SetParams(params:Array):void
		{
			this.params = params;
		}
		
		public function ShowScreen(screenClass:Class,...params):void
		{
			if (currentScreen)
			{
				removeChild(currentScreen);
				currentScreen.Die();
				currentScreen= null;
			}
			
			if (screenClass)
			{
				currentScreen = new screenClass();
				addChild(currentScreen );
				currentScreen.SetPapa(this);
				currentScreen.SetParams(params);
				currentScreen.Init();
				currentScreen.x = (WIDTH - currentScreen .width)/2-x;
				currentScreen.y = (HEIGHT - currentScreen .height)/2-y;
			}
		}
		
		
		
	}

}